package Homework0811;
import java.util.Scanner;
import java.util.Random;
import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        char[] VerCode=new char[4];
        Random rand=new Random();

        String RandomStr="0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
        for(int i=0;i<VerCode.length;i++){
            int randIndex=rand.nextInt(RandomStr.length());
            VerCode[i]=RandomStr.charAt(randIndex);
        }
        String code=new String(VerCode);
        System.out.println(code);
        System.out.println("请输入验证码:");
        Scanner sc=new Scanner(System.in);
        String input=sc.nextLine();

        if(code.equalsIgnoreCase(input))
            System.out.println("输入正确");
        else
            System.out.println("验证码错误");
    }
}
